package de.thwildau.tm.moses.thrift.serializer;

import com.google.inject.Inject;
import de.thwildau.tm.moses.thrift.services.ThriftGrammarAccess;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.IGrammarAccess;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.AbstractElementAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.GroupAlias;
import org.eclipse.xtext.serializer.analysis.GrammarAlias.TokenAlias;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynNavigable;
import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider.ISynTransition;
import org.eclipse.xtext.serializer.sequencer.AbstractSyntacticSequencer;

@SuppressWarnings("all")
public abstract class AbstractThriftSyntacticSequencer extends AbstractSyntacticSequencer {

	protected ThriftGrammarAccess grammarAccess;
	protected AbstractElementAlias match_AnnotationElement_ListSeparatorParserRuleCall_3_q;
	protected AbstractElementAlias match_ConstList_ListSeparatorParserRuleCall_1_1_1_q;
	protected AbstractElementAlias match_ConstMap_ListSeparatorParserRuleCall_1_1_3_q;
	protected AbstractElementAlias match_Const_ListSeparatorParserRuleCall_5_q;
	protected AbstractElementAlias match_EnumElement_ListSeparatorParserRuleCall_2_q;
	protected AbstractElementAlias match_Field_ListSeparatorParserRuleCall_7_q;
	protected AbstractElementAlias match_Field_Xsd_nillableKeyword_6_1_q;
	protected AbstractElementAlias match_Field_Xsd_optionalKeyword_6_0_q;
	protected AbstractElementAlias match_Field___Xsd_attrsKeyword_6_2_0_LeftCurlyBracketKeyword_6_2_1_RightCurlyBracketKeyword_6_2_3__q;
	protected AbstractElementAlias match_Function_ListSeparatorParserRuleCall_6_q;
	protected AbstractElementAlias match_Senum_ListSeparatorParserRuleCall_3_1_q;
	protected AbstractElementAlias match_Struct_Xsd_allKeyword_2_q;
	protected AbstractElementAlias match_ThrowsField_ListSeparatorParserRuleCall_3_q;
	protected AbstractElementAlias match_Union_Xsd_allKeyword_2_q;
	
	@Inject
	protected void init(IGrammarAccess access) {
		grammarAccess = (ThriftGrammarAccess) access;
		match_AnnotationElement_ListSeparatorParserRuleCall_3_q = new TokenAlias(false, true, grammarAccess.getAnnotationElementAccess().getListSeparatorParserRuleCall_3());
		match_ConstList_ListSeparatorParserRuleCall_1_1_1_q = new TokenAlias(false, true, grammarAccess.getConstListAccess().getListSeparatorParserRuleCall_1_1_1());
		match_ConstMap_ListSeparatorParserRuleCall_1_1_3_q = new TokenAlias(false, true, grammarAccess.getConstMapAccess().getListSeparatorParserRuleCall_1_1_3());
		match_Const_ListSeparatorParserRuleCall_5_q = new TokenAlias(false, true, grammarAccess.getConstAccess().getListSeparatorParserRuleCall_5());
		match_EnumElement_ListSeparatorParserRuleCall_2_q = new TokenAlias(false, true, grammarAccess.getEnumElementAccess().getListSeparatorParserRuleCall_2());
		match_Field_ListSeparatorParserRuleCall_7_q = new TokenAlias(false, true, grammarAccess.getFieldAccess().getListSeparatorParserRuleCall_7());
		match_Field_Xsd_nillableKeyword_6_1_q = new TokenAlias(false, true, grammarAccess.getFieldAccess().getXsd_nillableKeyword_6_1());
		match_Field_Xsd_optionalKeyword_6_0_q = new TokenAlias(false, true, grammarAccess.getFieldAccess().getXsd_optionalKeyword_6_0());
		match_Field___Xsd_attrsKeyword_6_2_0_LeftCurlyBracketKeyword_6_2_1_RightCurlyBracketKeyword_6_2_3__q = new GroupAlias(false, true, new TokenAlias(false, false, grammarAccess.getFieldAccess().getXsd_attrsKeyword_6_2_0()), new TokenAlias(false, false, grammarAccess.getFieldAccess().getLeftCurlyBracketKeyword_6_2_1()), new TokenAlias(false, false, grammarAccess.getFieldAccess().getRightCurlyBracketKeyword_6_2_3()));
		match_Function_ListSeparatorParserRuleCall_6_q = new TokenAlias(false, true, grammarAccess.getFunctionAccess().getListSeparatorParserRuleCall_6());
		match_Senum_ListSeparatorParserRuleCall_3_1_q = new TokenAlias(false, true, grammarAccess.getSenumAccess().getListSeparatorParserRuleCall_3_1());
		match_Struct_Xsd_allKeyword_2_q = new TokenAlias(false, true, grammarAccess.getStructAccess().getXsd_allKeyword_2());
		match_ThrowsField_ListSeparatorParserRuleCall_3_q = new TokenAlias(false, true, grammarAccess.getThrowsFieldAccess().getListSeparatorParserRuleCall_3());
		match_Union_Xsd_allKeyword_2_q = new TokenAlias(false, true, grammarAccess.getUnionAccess().getXsd_allKeyword_2());
	}
	
	@Override
	protected String getUnassignedRuleCallToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if(ruleCall.getRule() == grammarAccess.getListSeparatorRule())
			return getListSeparatorToken(semanticObject, ruleCall, node);
		return "";
	}
	
	/**
	 * ListSeparator: (',' | ';');
	 */
	protected String getListSeparatorToken(EObject semanticObject, RuleCall ruleCall, INode node) {
		if (node != null)
			return getTokenText(node);
		return ",";
	}
	
	@Override
	protected void emitUnassignedTokens(EObject semanticObject, ISynTransition transition, INode fromNode, INode toNode) {
		if (transition.getAmbiguousSyntaxes().isEmpty()) return;
		List<INode> transitionNodes = collectNodes(fromNode, toNode);
		for (AbstractElementAlias syntax : transition.getAmbiguousSyntaxes()) {
			List<INode> syntaxNodes = getNodesFor(transitionNodes, syntax);
			if(match_AnnotationElement_ListSeparatorParserRuleCall_3_q.equals(syntax))
				emit_AnnotationElement_ListSeparatorParserRuleCall_3_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ConstList_ListSeparatorParserRuleCall_1_1_1_q.equals(syntax))
				emit_ConstList_ListSeparatorParserRuleCall_1_1_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ConstMap_ListSeparatorParserRuleCall_1_1_3_q.equals(syntax))
				emit_ConstMap_ListSeparatorParserRuleCall_1_1_3_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Const_ListSeparatorParserRuleCall_5_q.equals(syntax))
				emit_Const_ListSeparatorParserRuleCall_5_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_EnumElement_ListSeparatorParserRuleCall_2_q.equals(syntax))
				emit_EnumElement_ListSeparatorParserRuleCall_2_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Field_ListSeparatorParserRuleCall_7_q.equals(syntax))
				emit_Field_ListSeparatorParserRuleCall_7_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Field_Xsd_nillableKeyword_6_1_q.equals(syntax))
				emit_Field_Xsd_nillableKeyword_6_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Field_Xsd_optionalKeyword_6_0_q.equals(syntax))
				emit_Field_Xsd_optionalKeyword_6_0_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Field___Xsd_attrsKeyword_6_2_0_LeftCurlyBracketKeyword_6_2_1_RightCurlyBracketKeyword_6_2_3__q.equals(syntax))
				emit_Field___Xsd_attrsKeyword_6_2_0_LeftCurlyBracketKeyword_6_2_1_RightCurlyBracketKeyword_6_2_3__q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Function_ListSeparatorParserRuleCall_6_q.equals(syntax))
				emit_Function_ListSeparatorParserRuleCall_6_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Senum_ListSeparatorParserRuleCall_3_1_q.equals(syntax))
				emit_Senum_ListSeparatorParserRuleCall_3_1_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Struct_Xsd_allKeyword_2_q.equals(syntax))
				emit_Struct_Xsd_allKeyword_2_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_ThrowsField_ListSeparatorParserRuleCall_3_q.equals(syntax))
				emit_ThrowsField_ListSeparatorParserRuleCall_3_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else if(match_Union_Xsd_allKeyword_2_q.equals(syntax))
				emit_Union_Xsd_allKeyword_2_q(semanticObject, getLastNavigableState(), syntaxNodes);
			else acceptNodes(getLastNavigableState(), syntaxNodes);
		}
	}

	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_AnnotationElement_ListSeparatorParserRuleCall_3_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_ConstList_ListSeparatorParserRuleCall_1_1_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_ConstMap_ListSeparatorParserRuleCall_1_1_3_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_Const_ListSeparatorParserRuleCall_5_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_EnumElement_ListSeparatorParserRuleCall_2_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_Field_ListSeparatorParserRuleCall_7_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     'xsd_nillable'?
	 */
	protected void emit_Field_Xsd_nillableKeyword_6_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     'xsd_optional'?
	 */
	protected void emit_Field_Xsd_optionalKeyword_6_0_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ('xsd_attrs' '{' '}')?
	 */
	protected void emit_Field___Xsd_attrsKeyword_6_2_0_LeftCurlyBracketKeyword_6_2_1_RightCurlyBracketKeyword_6_2_3__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_Function_ListSeparatorParserRuleCall_6_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_Senum_ListSeparatorParserRuleCall_3_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     'xsd_all'?
	 */
	protected void emit_Struct_Xsd_allKeyword_2_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     ListSeparator?
	 */
	protected void emit_ThrowsField_ListSeparatorParserRuleCall_3_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
	/**
	 * Syntax:
	 *     'xsd_all'?
	 */
	protected void emit_Union_Xsd_allKeyword_2_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
		acceptNodes(transition, nodes);
	}
	
}
